<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMerchantMedicineApplyTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('merchant_medicine_apply', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger('enterprise_id') ->default(0) ->comment('商家id');
            $table->bigInteger('merchant_id')   ->default(0) ->comment('门店id');
            $table->string('name')              ->default('')->comment('药品名称');
            $table->string('desc')              ->default('')->comment('描述');
            $table->string('upc')               ->default('')->comment('条形码');
            $table->string('sku_ssn')           ->default('')->comment('内部库存编号');
            $table->string('approval_number')   ->default('')->comment('批准文号');
            $table->string('specification')     ->default('')->comment('规格');
            $table->string('thumb_id')          ->nullable()    ->comment('商品封面图');
            $table->decimal('selling_price')    ->default(0)->comment('销售价格');//商家自定义
            $table->integer('stock')            ->default(0)->comment('库存');//商家自定义
            $table->integer('classify_id')      ->default(0)   ->comment('');
            $table->integer('drug_type')        ->default(0)   ->comment('药品分类：OTC甲乙、RX等');
            $table->string('manufacturer')      ->default('')   ->comment('生产厂商名称');
            $table->string('manufacturer_address')->default('')   ->comment('生产厂商地址');
            $table->string('manufacturer_contact')->default('')   ->comment('生产厂商联系方式');
            $table->string('electronic_regulatory_code') ->default('')   ->comment('电子监管码');
            $table->text('usage_and_dosage')    ->nullable()   ->comment('用法用量');
            $table->text('indications')         ->nullable()   ->comment('适应症');
            $table->string('adapt_to_the_crowd')->default('')   ->comment('适应人群');
            $table->string('component')         ->default('')   ->comment('成分');
            $table->text('adverse_reactions')   ->nullable()   ->comment('不良反应');
            $table->text('contraindications')   ->nullable()   ->comment('禁忌');
            $table->text('precautions')         ->nullable()   ->comment('注意事项');
            $table->text('interaction')         ->nullable()   ->comment('药物相互作用');
            $table->text('medication_for_children') ->nullable()   ->comment('儿童用药');
            $table->text('medication_for_pregnancy_x_lactation') ->nullable()   ->comment('妊娠与哺乳用药');
            $table->text('medication_for_aged') ->nullable()   ->comment('老年人用药');
            $table->string('properties')        ->default('')   ->comment('性状');
            $table->string('packing')           ->default('')   ->comment('包装');
            $table->string('dosage_form')       ->default('')   ->comment('剂型');
            $table->string('storage')           ->default('')   ->comment('贮藏');
            $table->text('pharmacological_action') ->nullable()   ->comment('药理作用');
            $table->string('expiry_date')       ->default('')   ->comment('有效期');
            $table->mediumText('detail')        ->nullable()          ->comment('详情（富文本）');
            $table->integer('is_shop')          ->default(0)    ->comment('是否上架，0：否 1：是');
            $table->integer('sort')             ->default(0)    ->comment('商品排序，整数，数字越低排序越前');
            $table->text('other_attribute_array')->nullable()   ->comment('其他属性数组（json_encoded）');
            $table->integer('review')            ->default(0)->comment('审核状态 0：待审核 1：通过 2：拒绝');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('merchant_medicine_apply');
    }
}
